<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/3/3
 * Time: 21:07
 */

namespace app\recruit\admin;


use app\system\admin\Admin;
use app\common\model\RecruitClassify as classifyModel;

class Classify extends Admin
{

    protected $hisiModel = 'RecruitClassify';//模型名称[通用添加、修改专用]

    public function index()
    {
        if ($this->request->isAjax()) {
            $where      = $data = [];
            $page       = $this->request->param('page/d', 1);
            $limit      = $this->request->param('limit/d', 15);
            $keyword    = $this->request->param('keyword/s');

            if ($keyword) {
                $where[] = ['name', 'like', "%{$keyword}%"];
            }

            $data['data'] = classifyModel::where($where)->page($page)->limit($limit)->select();

            $data['count'] = classifyModel::where($where)->count('id');
            $data['code'] = 0;
            $data['msg'] = '';
            return json($data);
        }

        $assign = [];

        return $this->assign($assign)->fetch();
    }
}